<?php
/**
 * Author: 周斌斌 <553193368@qq.com>
 * Date: 17/3/7 PM5:28
 * 摘要:
 */

namespace app\dv1\validate;


use think\Validate;

class DriverItineraryValidate extends Validate
{
    protected $rule = [
        ['driverId', ['require'], ['司机id为空']],
//        ['startLng', ['require', 'regex' => '/^[\-\+]?(0?\d{1,2}\.\d{1,5}|1[0-7]?\d{1}\.\d{1,5}|180\.0{1,10})$/'], ['起始经度为空', '经度格式不正确']],
        ['startLng', ['require'], ['起始经度为空']],
//        ['startLat', ['require', 'regex' => '/^[\-\+]?([0-8]?\d{1}\.\d{1,5}|90\.0{1,10})$/'], ['起始纬度为空', '纬度格式不正确']],
        ['startLat', ['require'], ['起始纬度为空']],
        ['startName', ['require'], ['起始位置名称为空']],
//        ['endLng', ['require', 'regex' => '/^[\-\+]?(0?\d{1,2}\.\d{1,5}|1[0-7]?\d{1}\.\d{1,5}|180\.0{1,10})$/'], ['结束经度为空', '经度格式不正确']],
        ['endLng', ['require'], ['结束经度为空']],
//        ['endLat', ['require', 'regex' => '/^[\-\+]?([0-8]?\d{1}\.\d{1,5}|90\.0{1,10})$/'], ['结束纬度为空', '纬度格式不正确']],
        ['endLat', ['require'], ['结束纬度为空']],
        ['endName', ['require'], ['结束位置名称为空']],
        ['date', ['require'], ['请输入约定时间为空']],
//        ['cargoType', ['require'], ['请选择载货类型']],
//        ['additionalServices', ['require'], ['请选择额外服务']],
//        ['oneHalfwayLng', ['regex' => '/^[\-\+]?(0?\d{1,2}\.\d{1,5}|1[0-7]?\d{1}\.\d{1,5}|180\.0{1,10})$/'], '中途1经度格式不正确'],
//        ['oneHalfwayLat', ['regex' => '/^[\-\+]?([0-8]?\d{1}\.\d{1,5}|90\.0{1,10})$/'], '中途1纬度格式不正确'],
//        ['twoHalfwayLng', ['regex' => '/^[\-\+]?(0?\d{1,2}\.\d{1,5}|1[0-7]?\d{1}\.\d{1,5}|180\.0{1,10})$/'], '中途2经度格式不正确'],
//        ['twoHalfwayLat', ['regex' => '/^[\-\+]?([0-8]?\d{1}\.\d{1,5}|90\.0{1,10})$/'], '中途2纬度格式不正确']
    ];

    protected $scene = [
        // 发布顺风车
        'release' => ['driverId', 'startLng', 'startLat', 'startName', 'endLng', 'endLat', 'endName'],
        'releaseTruck' => ['driverId', 'startLng', 'startLat', 'startName', 'endLng', 'endLat', 'endName']
    ];
}